From 251aac811be5cdaa2fd015c6bf3e1e164b0b714c Mon Sep 17 00:00:00 2001 From: Udeshya Dhungana <075bct095.udeshya@pcampus.edu.np> Date: Tue, 11 Nov 2025 13:16:20 +0545 Subject: [PATCH 01/12] Grep/Highlighting --- .gitignore | 3 + course-definition.yml | 46 ++++++++++++++ stage_descriptions/highlighting-01-bx9.md | 32 ++++++++++ stage_descriptions/highlighting-02-bm2.md | 76 +++++++++++++++++++++++ stage_descriptions/highlighting-03-jk4.md | 29 +++++++++ stage_descriptions/highlighting-04-na5.md | 75 ++++++++++++++++++++++ stage_descriptions/highlighting-05-nd0.md | 59 ++++++++++++++++++ 7 files changed, 320 insertions(+) create mode 100644 stage_descriptions/highlighting-01-bx9.md create mode 100644 stage_descriptions/highlighting-02-bm2.md create mode 100644 stage_descriptions/highlighting-03-jk4.md create mode 100644 stage_descriptions/highlighting-04-na5.md create mode 100644 stage_descriptions/highlighting-05-nd0.md diff --git a/.gitignore b/.gitignore index 132c5ef..5d9b45e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ course-definition-tester .history/ + +## MacOS +.DS_Store diff --git a/course-definition.yml b/course-definition.yml index 8a9cd42..245d9b6 100644 --- a/course-definition.yml +++ b/course-definition.yml @@ -76,6 +76,16 @@ extensions: Along the way, you'll learn about how to implement the `*` quantifier (zero or more), and bounded quantifiers. [1]: https://learn.microsoft.com/en-us/dotnet/standard/base-types/quantifiers-in-regular-expressions + - slug: "highlighting" + name: "Highlighting" + description_markdown: | + In this challenge extension, you'll add support for [highlighting][1] to your Grep implementation. + + Along the way, you'll learn about [ANSI escape codes][2], and more. + + [1]: https://linuxcommando.blogspot.com/2007/10/grep-with-color-output.html + [2]: https://en.wikipedia.org/wiki/ANSI_escape_code + stages: - slug: "cq2" name: "Match a literal character" @@ -304,3 +314,39 @@ stages: difficulty: hard marketing_md: |- In this stage, we'll add support for `{n,m}`, the [between n and m times](https://docs.microsoft.com/en-us/dotnet/standard/base-types/quantifiers-in-regular-expressions#match-between-n-and-m-times-nm) quantifier. + + # Highlighting + - slug: "bx9" + primary_extension_slug: "highlighting" + name: "Print matching line to standard output" + difficulty: easy + marketing_md: |- + In this stage, you'll add support for printing the matched line in the standard output of your grep implementation. + + - slug: "bm2" + primary_extension_slug: "highlighting" + name: "Highlight the matched text" + difficulty: hard + marketing_md: |- + In this stage, you'll add support for highlighting the matched text in your grep implementation. + + - slug: "jk4" + primary_extension_slug: "highlighting" + name: "The `never` coloring option" + difficulty: easy + marketing_md: |- + In this stage, you'll add support for disabling the highlighting in your grep implementation using the `never` coloring option. + + - slug: "na5" + primary_extension_slug: "highlighting" + name: "The `auto` coloring option" + difficulty: medium + marketing_md: |- + In this stage, you'll add support for `auto` coloring option in the `--color` flag in your grep implementation. + + - slug: "nd0" + primary_extension_slug: "highlighting" + name: "The default behavior" + difficulty: easy + marketing_md: |- + In this stage, you'll implement the `auto` coloring option as the default coloring option when the `--color` flag is not present. diff --git a/stage_descriptions/highlighting-01-bx9.md b/stage_descriptions/highlighting-01-bx9.md new file mode 100644 index 0000000..1f35d91 --- /dev/null +++ b/stage_descriptions/highlighting-01-bx9.md @@ -0,0 +1,32 @@ +In this stage, you'll add support for printing the matched line in the standard output of your grep implementation. + +### Printing matched line to the standard output + +When a line is matched, grep prints the matched line to the standard output. + +Example usage: + +```bash +$ echo -n "caats" | grep -E "ca+ts" +caats +``` + +### Tests + +The tester will execute your program like this: + +```bash +$ echo -n "dogs" | ./your_program.sh -E "dogs?" +dogs +``` + +If the input matches the pattern, your program must: +- Exit with the code 0 +- Print the input line to the standard output + +If the input does not match the pattern, your program must: +- Exit with the code 1 + +### Notes + +- You only need to print the matched line to the standard output. You don't need to highlight the matched text. We'll get to that in the later stages. \ No newline at end of file diff --git a/stage_descriptions/highlighting-02-bm2.md b/stage_descriptions/highlighting-02-bm2.md new file mode 100644 index 0000000..c9d6efd --- /dev/null +++ b/stage_descriptions/highlighting-02-bm2.md @@ -0,0 +1,76 @@ +In this stage, you'll add support for highlighting the matched text in your grep implementation. + +### Highlighting the matched text + +When `--color=always` option is used with grep, it always highlights the matched text in its output. + +Example usage: + + +
+$ echo -n "I have 1 apple" | grep --color=always -E '\d'
+I have 1 apple
+
+
+ + +Grep uses [ANSI escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code) to add color to terminal output. These are special character sequences that terminals interpret as formatting commands rather than regular text. + +The default color used by grep for the matched text is bold red. The ANSI escape sequence to be used for wrapping the matched text is: +``` +\033[01;31m\033[K +... +\033[m\033[K +``` + +#### Opening Sequence: `\033[01;31m\033[K` + +| Component | Meaning | +|-----------|---------| +| `\033` | Escape character that introduces the ANSI control sequence | +| `[` | Start marker for Select Graphic Rendition (SGR) parameters | +| `01;31` | SGR codes: `01` = bold/bright text, `31` = red foreground color (separated by `;`) | +| `m` | Terminates the SGR sequence | +| | +| `\033` | Escape character that introduces the ANSI control sequence | +| `[` | Start marker for SGR parameters | +| `K` | Erase all characters to the right of the cursor | + +#### Closing Sequence: `\033[m\033[K` + +| Component | Meaning | +|-----------|---------| +| `\033` | Escape character that introduces the ANSI control sequence | +| `[` | Start marker for SGR parameters | +| *(empty)* | No parameters = reset all attributes to default | +| `m` | Terminates the SGR sequence | +| | +| `\033` | Escape character that introduces the ANSI control sequence +| `[` | Start marker for SGR parameters | +| `K` | Erase all characters to the right of the cursor | + +**Note:** When the SGR parameter is `0` or is not present (empty), it resets all attributes so that the rest of the text will be printed without any highlights. + +### Tests + +The tester will execute your program like this: + + +
+$ echo -n "I have 3 apples" | grep --color=always -E '\d'
+I have 3 apples
+
+
+ + +If the input does not match the pattern, your program must: +- Exit with the code 1 + +If the input text matches the pattern, your program must: +- Exit with the code 0 +- Print the input text to the standard output +- Highlight the matched text in the input using the grep's default color. + +### Notes + +- You can use any combination of the escape sequences as long as the matched text is highlighted using the bold (`01`) and red (`31`) attributes. \ No newline at end of file diff --git a/stage_descriptions/highlighting-03-jk4.md b/stage_descriptions/highlighting-03-jk4.md new file mode 100644 index 0000000..ea730aa --- /dev/null +++ b/stage_descriptions/highlighting-03-jk4.md @@ -0,0 +1,29 @@ +In this stage, you'll add support for disabling the highlighting in your grep implementation using the `never` coloring option. + +### The `--color=never` option + +When a line is matched, grep only prints the matched line to the standard output. It does not highlight the matched text. + +Example usage: + +```bash +$ echo -n "Sally has 3 parrots" | grep --color=never -E "par+ots?" +Sally has 3 parrots +``` + +### Tests + +The tester will execute your program like this: + +```bash +$ echo -n "I have 5 vegetables" | grep --color=never -E '\d' +I have 5 vegetables +``` + +If the input matches the pattern, your program must: +- Exit with the code 0 +- Print the input line to the standard output +- No highlights should be placed in the output text because `--color=never` option is being used. + +If the input does not match the pattern, your program must: +- Exit with the code 1 \ No newline at end of file diff --git a/stage_descriptions/highlighting-04-na5.md b/stage_descriptions/highlighting-04-na5.md new file mode 100644 index 0000000..b8eb6f8 --- /dev/null +++ b/stage_descriptions/highlighting-04-na5.md @@ -0,0 +1,75 @@ +In this stage, you'll add support for `auto` coloring option in the `--color` flag in your grep implementation. + +### The `auto` color option + +When `--color=auto` option is used with grep, it behaves in the following manner: + +- If the output stream is piped to another command, or redirected to a file, highlighting is disabled. + +- If the output stream is neither piped to another command, nor redirected to a file, highlighting is enabled. + +Example usage: + + +
+$ echo -n "I have 3 cows" | grep --color=auto -E 'cows'
+I have 3 cows
+
+
+ + +The output text is highlighted in this case. + +When the output stream is piped to another command, or redirected to a file, the ANSI highlighting sequences are not placed in the output text. + +```bash +# Output stream is piped to another command +$ echo -n "apple123" | grep --color=auto -E '\d' | hexdump -C +00000000 61 70 70 6c 65 31 32 33 0a |apple123.| +00000009 + +# Output stream is redirected to a file +$ echo -n "apple123" | grep --color=auto -E '\d' >> output.txt + +$ hexdump -C output.txt +00000000 61 70 70 6c 65 31 32 33 0a |apple123.| +00000009 +``` + +### Tests + +The tester will execute your program like this: + + +
+$ echo -n "I have 4 cats" | grep --color=auto -E 'cats'
+I have 4 cats
+
+
+ + +If the input does not match the pattern, your program must: +- Exit with the code 1 + +If the input text matches the pattern, your program must: +- Exit with the code 0 +- Print the input text to the standard output +- The matched text in the output should be highlighted + +The tester will also execute your program like this: + +```bash +# Redirection to a file +$ echo -n "apple211" | grep --color=auto -E '\d' >> file.txt + +# Piping to another command +$ echo -n "apple211" | grep --color=auto -E '\d' | another_command +``` + +For both of these cases, +If the input does not match the pattern, your program must: +- Exit with the code 1 + +If the input text matches the pattern, your program must exit with the code 0 and +- The input text should be written to the file `file.txt`, or be supplied to another command, depending on the case. +- The ANSI escape sequence for highlighting should not be present inside the file, or supplied to another command, depending on the case. \ No newline at end of file diff --git a/stage_descriptions/highlighting-05-nd0.md b/stage_descriptions/highlighting-05-nd0.md new file mode 100644 index 0000000..d1a6278 --- /dev/null +++ b/stage_descriptions/highlighting-05-nd0.md @@ -0,0 +1,59 @@ +In this stage, you'll implement the `auto` coloring option as the default coloring option when the `--color` flag is not present. + +### The default behavior + +When the `--color` flag is not present, it is equivalent of using grep with the `--color=auto` option. + +Example usage: + + +
+$ echo -n "I have 3 cows" | grep -E 'cows'
+I have 3 cows
+
+
+ + +The output text is highlighted in this case. + +When the output is piped to another command, or if it is being redirected to a file, the ANSI highlighting sequences are not present in the output text. + +```bash +$ echo -n "I have 3 dogs" | grep -E '\d' | hexdump -C +00000000 49 20 68 61 76 65 20 33 20 64 6f 67 73 0a |I have 3 dogs.| +0000000e +``` + +### Tests + +The tester will execute your program like this: + +```bash +$ echo -n "apple321" | grep -E '\d' +``` + +If the input does not match the pattern, your program must: +- Exit with the code 1 + +If the input text matches the pattern, your program must: +- Exit with the code 0 +- Print the input text to the standard output +- The matched text in the output should be highlighted + +The tester will also execute your program like this: + +```bash +# Redirection to a file +$ echo -n "apple211" | grep -E '\d' >> file.txt + +# Piping to another command +$ echo -n "apple211" | grep -E '\d' | another_command +``` + +For both of these cases, +If the input does not match the pattern, your program must: +- Exit with the code 1 + +If the input text matches the pattern, your program must exit with the code 0 and +- The input text should be written to the file `file.txt`, or be supplied to another command, depending on the case. +- The ANSI escape sequence for highlighting should not be present inside the file, or supplied to another command, depending on the case. \ No newline at end of file From fc5966ecffca73d28005f8aea5b9c97e90b7e3fc Mon Sep 17 00:00:00 2001 From: Udeshya Dhungana <075bct095.udeshya@pcampus.edu.np> Date: Tue, 11 Nov 2025 13:19:38 +0545 Subject: [PATCH 02/12] Fix html --- stage_descriptions/highlighting-02-bm2.md | 6 ++---- stage_descriptions/highlighting-04-na5.md | 6 ++---- stage_descriptions/highlighting-05-nd0.md | 3 +-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/stage_descriptions/highlighting-02-bm2.md b/stage_descriptions/highlighting-02-bm2.md index c9d6efd..1aa8d48 100644 --- a/stage_descriptions/highlighting-02-bm2.md +++ b/stage_descriptions/highlighting-02-bm2.md @@ -9,8 +9,7 @@ Example usage:
 $ echo -n "I have 1 apple" | grep --color=always -E '\d'
-I have 1 apple
-
+I have 1 apple
 
@@ -58,8 +57,7 @@ The tester will execute your program like this:
 $ echo -n "I have 3 apples" | grep --color=always -E '\d'
-I have 3 apples
-
+I have 3 apples
 
diff --git a/stage_descriptions/highlighting-04-na5.md b/stage_descriptions/highlighting-04-na5.md index b8eb6f8..5bb45ca 100644 --- a/stage_descriptions/highlighting-04-na5.md +++ b/stage_descriptions/highlighting-04-na5.md @@ -13,8 +13,7 @@ Example usage:
 $ echo -n "I have 3 cows" | grep --color=auto -E 'cows'
-I have 3 cows
-
+I have 3 cows
 
@@ -43,8 +42,7 @@ The tester will execute your program like this:
 $ echo -n "I have 4 cats" | grep --color=auto -E 'cats'
-I have 4 cats
-
+I have 4 cats
 
diff --git a/stage_descriptions/highlighting-05-nd0.md b/stage_descriptions/highlighting-05-nd0.md index d1a6278..e1d529d 100644 --- a/stage_descriptions/highlighting-05-nd0.md +++ b/stage_descriptions/highlighting-05-nd0.md @@ -9,8 +9,7 @@ Example usage:
 $ echo -n "I have 3 cows" | grep -E 'cows'
-I have 3 cows
-
+I have 3 cows
 
From 5803d8a9c5a665dff62d9c312d73eb4f2c8dab8d Mon Sep 17 00:00:00 2001 From: Udeshya Dhungana <075bct095.udeshya@pcampus.edu.np> Date: Tue, 11 Nov 2025 13:22:49 +0545 Subject: [PATCH 03/12] Apply LLM suggestions --- stage_descriptions/highlighting-02-bm2.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stage_descriptions/highlighting-02-bm2.md b/stage_descriptions/highlighting-02-bm2.md index 1aa8d48..4c2a6df 100644 --- a/stage_descriptions/highlighting-02-bm2.md +++ b/stage_descriptions/highlighting-02-bm2.md @@ -22,7 +22,7 @@ The default color used by grep for the matched text is bold red. The ANSI escape \033[m\033[K ``` -#### Opening Sequence: `\033[01;31m\033[K` +**Opening Sequence: `\033[01;31m\033[K`** | Component | Meaning | |-----------|---------| @@ -35,7 +35,7 @@ The default color used by grep for the matched text is bold red. The ANSI escape | `[` | Start marker for SGR parameters | | `K` | Erase all characters to the right of the cursor | -#### Closing Sequence: `\033[m\033[K` +**Closing Sequence: `\033[m\033[K`** | Component | Meaning | |-----------|---------| @@ -48,7 +48,7 @@ The default color used by grep for the matched text is bold red. The ANSI escape | `[` | Start marker for SGR parameters | | `K` | Erase all characters to the right of the cursor | -**Note:** When the SGR parameter is `0` or is not present (empty), it resets all attributes so that the rest of the text will be printed without any highlights. +When the SGR parameter is `0` or is not present (empty), it resets all attributes so that the rest of the text will be printed without any highlights. ### Tests @@ -71,4 +71,4 @@ If the input text matches the pattern, your program must: ### Notes -- You can use any combination of the escape sequences as long as the matched text is highlighted using the bold (`01`) and red (`31`) attributes. \ No newline at end of file +- The matched text should highlighted using the bold (`01`) and red (`31`) attributes. You may use any sequences of ANSI codes to achieve this highlighting effect. \ No newline at end of file From 02721962d47babd31dea3575738e21ea92d2cd18 Mon Sep 17 00:00:00 2001 From: Udeshya Dhungana <075bct095.udeshya@pcampus.edu.np> Date: Tue, 11 Nov 2025 14:20:42 +0545 Subject: [PATCH 04/12] Clarify instructions --- stage_descriptions/highlighting-01-bx9.md | 2 +- stage_descriptions/highlighting-02-bm2.md | 15 ++++++++++++-- stage_descriptions/highlighting-04-na5.md | 24 +++++++++++++++-------- stage_descriptions/highlighting-05-nd0.md | 20 ++++++++++++++----- 4 files changed, 45 insertions(+), 16 deletions(-) diff --git a/stage_descriptions/highlighting-01-bx9.md b/stage_descriptions/highlighting-01-bx9.md index 1f35d91..c696b30 100644 --- a/stage_descriptions/highlighting-01-bx9.md +++ b/stage_descriptions/highlighting-01-bx9.md @@ -2,7 +2,7 @@ In this stage, you'll add support for printing the matched line in the standard ### Printing matched line to the standard output -When a line is matched, grep prints the matched line to the standard output. +If a line from the standard intput is matched, grep prints the matched line to the standard output. Example usage: diff --git a/stage_descriptions/highlighting-02-bm2.md b/stage_descriptions/highlighting-02-bm2.md index 4c2a6df..a51d387 100644 --- a/stage_descriptions/highlighting-02-bm2.md +++ b/stage_descriptions/highlighting-02-bm2.md @@ -27,7 +27,7 @@ The default color used by grep for the matched text is bold red. The ANSI escape | Component | Meaning | |-----------|---------| | `\033` | Escape character that introduces the ANSI control sequence | -| `[` | Start marker for Select Graphic Rendition (SGR) parameters | +| `[` | Start marker for Select [Graphic Rendition (SGR)](https://vt100.net/docs/vt510-rm/SGR.html) parameters | | `01;31` | SGR codes: `01` = bold/bright text, `31` = red foreground color (separated by `;`) | | `m` | Terminates the SGR sequence | | | @@ -71,4 +71,15 @@ If the input text matches the pattern, your program must: ### Notes -- The matched text should highlighted using the bold (`01`) and red (`31`) attributes. You may use any sequences of ANSI codes to achieve this highlighting effect. \ No newline at end of file +1. The matched text should highlighted using the bold (`01`) and red (`31`) attributes. You may use any combination of ANSI codes to achieve this highlighting effect. For example, to produce the following output: + + +
+hellomatchedworld
+
+ + +Any of the following sequences could be used: +- `hello\033[01;31m\033[Kmatched\033[m\033[Kworld` +- `hello\033[31;01m\033[Kmatched\033[m\033[Kworld` +- `hello\033[31;01m\033[K\033[Kmatched\033[m\033[K\033[Kworld` \ No newline at end of file diff --git a/stage_descriptions/highlighting-04-na5.md b/stage_descriptions/highlighting-04-na5.md index 5bb45ca..9fe8109 100644 --- a/stage_descriptions/highlighting-04-na5.md +++ b/stage_descriptions/highlighting-04-na5.md @@ -4,22 +4,24 @@ In this stage, you'll add support for `auto` coloring option in the `--color` fl When `--color=auto` option is used with grep, it behaves in the following manner: -- If the output stream is piped to another command, or redirected to a file, highlighting is disabled. +- If the output stream is a [TTY device](https://www.ibm.com/docs/en/aix/7.1.0?topic=communications-tty-terminal-device), like the terminal, highlighting is enabled. -- If the output stream is neither piped to another command, nor redirected to a file, highlighting is enabled. +- If the output stream is not a TTY device, for example, the output is piped to another command, or being redirected to a non-TTY device, highlighting is disabled. Example usage:
 $ echo -n "I have 3 cows" | grep --color=auto -E 'cows'
+I have 3 cows
+$ echo -n "I have 4 cows" | grep --color=auto -E 'cows' >> /dev/tty
 I have 3 cows
 
-The output text is highlighted in this case. +The output text is highlighted in this case since the output in both cases is a TTY device. -When the output stream is piped to another command, or redirected to a file, the ANSI highlighting sequences are not placed in the output text. +When the output stream is piped to another command, or redirected to a non-TTY device, the ANSI highlighting sequences are not placed in the output text. ```bash # Output stream is piped to another command @@ -27,7 +29,7 @@ $ echo -n "apple123" | grep --color=auto -E '\d' | hexdump -C 00000000 61 70 70 6c 65 31 32 33 0a |apple123.| 00000009 -# Output stream is redirected to a file +# Output stream is redirected to a non-TTY device $ echo -n "apple123" | grep --color=auto -E '\d' >> output.txt $ hexdump -C output.txt @@ -42,7 +44,9 @@ The tester will execute your program like this:
 $ echo -n "I have 4 cats" | grep --color=auto -E 'cats'
-I have 4 cats
+I have 4 cats
+$ echo -n "I have 5 cats" | grep --color=auto -E 'cats' >> /dev/tty
+I have 5 cats
 
@@ -57,7 +61,7 @@ If the input text matches the pattern, your program must: The tester will also execute your program like this: ```bash -# Redirection to a file +# Redirection to a non-tty device $ echo -n "apple211" | grep --color=auto -E '\d' >> file.txt # Piping to another command @@ -70,4 +74,8 @@ If the input does not match the pattern, your program must: If the input text matches the pattern, your program must exit with the code 0 and - The input text should be written to the file `file.txt`, or be supplied to another command, depending on the case. -- The ANSI escape sequence for highlighting should not be present inside the file, or supplied to another command, depending on the case. \ No newline at end of file +- The ANSI escape sequence for highlighting should not be present inside the file, or supplied to another command, depending on the case. + +### Notes + +- You might find it helpful to use the equivalent of [`isatty()`](https://man7.org/linux/man-pages/man3/isatty.3.html) function in your programming language to check whether the output stream is a TTY device. \ No newline at end of file diff --git a/stage_descriptions/highlighting-05-nd0.md b/stage_descriptions/highlighting-05-nd0.md index e1d529d..d152cce 100644 --- a/stage_descriptions/highlighting-05-nd0.md +++ b/stage_descriptions/highlighting-05-nd0.md @@ -9,18 +9,28 @@ Example usage:
 $ echo -n "I have 3 cows" | grep -E 'cows'
+I have 3 cows
+$ echo -n "I have 4 cows" | grep -E 'cows' >> /dev/tty
 I have 3 cows
 
The output text is highlighted in this case. -When the output is piped to another command, or if it is being redirected to a file, the ANSI highlighting sequences are not present in the output text. +When the output stream is piped to another command, or redirected to a non-TTY device, the ANSI highlighting sequences are not placed in the output text. ```bash -$ echo -n "I have 3 dogs" | grep -E '\d' | hexdump -C -00000000 49 20 68 61 76 65 20 33 20 64 6f 67 73 0a |I have 3 dogs.| -0000000e +# Output stream is piped to another command +$ echo -n "apple123" | grep -E '\d' | hexdump -C +00000000 61 70 70 6c 65 31 32 33 0a |apple123.| +00000009 + +# Output stream is redirected to a non-TTY device +$ echo -n "apple123" | grep -E '\d' >> output.txt + +$ hexdump -C output.txt +00000000 61 70 70 6c 65 31 32 33 0a |apple123.| +00000009 ``` ### Tests @@ -42,7 +52,7 @@ If the input text matches the pattern, your program must: The tester will also execute your program like this: ```bash -# Redirection to a file +# Redirection to a non-tty device $ echo -n "apple211" | grep -E '\d' >> file.txt # Piping to another command From 3e7644756b0b9099082bf0eb69a365b91168d45f Mon Sep 17 00:00:00 2001 From: Udeshya Dhungana <075bct095.udeshya@pcampus.edu.np> Date: Tue, 11 Nov 2025 15:00:45 +0545 Subject: [PATCH 05/12] Apply LLM suggestions --- stage_descriptions/highlighting-02-bm2.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/stage_descriptions/highlighting-02-bm2.md b/stage_descriptions/highlighting-02-bm2.md index a51d387..83d3481 100644 --- a/stage_descriptions/highlighting-02-bm2.md +++ b/stage_descriptions/highlighting-02-bm2.md @@ -22,7 +22,7 @@ The default color used by grep for the matched text is bold red. The ANSI escape \033[m\033[K ``` -**Opening Sequence: `\033[01;31m\033[K`** +**Exaple Opening Sequence: `\033[01;31m\033[K`** | Component | Meaning | |-----------|---------| @@ -35,7 +35,7 @@ The default color used by grep for the matched text is bold red. The ANSI escape | `[` | Start marker for SGR parameters | | `K` | Erase all characters to the right of the cursor | -**Closing Sequence: `\033[m\033[K`** +**Example Closing Sequence: `\033[m\033[K`** | Component | Meaning | |-----------|---------| @@ -79,7 +79,10 @@ If the input text matches the pattern, your program must: -Any of the following sequences could be used: -- `hello\033[01;31m\033[Kmatched\033[m\033[Kworld` -- `hello\033[31;01m\033[Kmatched\033[m\033[Kworld` -- `hello\033[31;01m\033[K\033[Kmatched\033[m\033[K\033[Kworld` \ No newline at end of file +Any of the following sequences could be used + +``` +hello\033[31;01m\033[Kmatched\033[m\033[Kworld +hello\033[31;01m\033[K\033[Kmatched\033[m\033[K\033[Kworld +hello\033[01;31m\033[Kmatched\033[m\033[Kworld +``` \ No newline at end of file From d4c4ff6894858a3a1a9deb0d815d5616af78a75b Mon Sep 17 00:00:00 2001 From: Udeshya Dhungana <075bct095.udeshya@pcampus.edu.np> Date: Tue, 11 Nov 2025 15:34:06 +0545 Subject: [PATCH 06/12] Apply LLM suggestions --- stage_descriptions/highlighting-01-bx9.md | 4 ++-- stage_descriptions/highlighting-02-bm2.md | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/stage_descriptions/highlighting-01-bx9.md b/stage_descriptions/highlighting-01-bx9.md index c696b30..a57276a 100644 --- a/stage_descriptions/highlighting-01-bx9.md +++ b/stage_descriptions/highlighting-01-bx9.md @@ -1,8 +1,8 @@ In this stage, you'll add support for printing the matched line in the standard output of your grep implementation. -### Printing matched line to the standard output +### Printing the matched line -If a line from the standard intput is matched, grep prints the matched line to the standard output. +If a line from the standard input is matched, grep prints the matched line to the standard output. Example usage: diff --git a/stage_descriptions/highlighting-02-bm2.md b/stage_descriptions/highlighting-02-bm2.md index 83d3481..d4f7b5c 100644 --- a/stage_descriptions/highlighting-02-bm2.md +++ b/stage_descriptions/highlighting-02-bm2.md @@ -15,7 +15,8 @@ I have 1 apple Grep uses [ANSI escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code) to add color to terminal output. These are special character sequences that terminals interpret as formatting commands rather than regular text. -The default color used by grep for the matched text is bold red. The ANSI escape sequence to be used for wrapping the matched text is: +The default color used by grep for the matched text is bold red. For example, grep uses the following ANSI escape sequences for wrapping the matched text: + ``` \033[01;31m\033[K ... @@ -27,7 +28,7 @@ The default color used by grep for the matched text is bold red. The ANSI escape | Component | Meaning | |-----------|---------| | `\033` | Escape character that introduces the ANSI control sequence | -| `[` | Start marker for Select [Graphic Rendition (SGR)](https://vt100.net/docs/vt510-rm/SGR.html) parameters | +| `[` | Start marker for [Select Graphic Rendition (SGR)](https://vt100.net/docs/vt510-rm/SGR.html) parameters | | `01;31` | SGR codes: `01` = bold/bright text, `31` = red foreground color (separated by `;`) | | `m` | Terminates the SGR sequence | | | From 480ace96fb7f6b012d5f75b760a8136fe9342dfc Mon Sep 17 00:00:00 2001 From: Udeshya Dhungana <075bct095.udeshya@pcampus.edu.np> Date: Tue, 11 Nov 2025 15:46:36 +0545 Subject: [PATCH 07/12] Polish test cases and examples --- stage_descriptions/highlighting-02-bm2.md | 2 +- stage_descriptions/highlighting-04-na5.md | 16 ++++++++-------- stage_descriptions/highlighting-05-nd0.md | 18 +++++++++--------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/stage_descriptions/highlighting-02-bm2.md b/stage_descriptions/highlighting-02-bm2.md index d4f7b5c..c786628 100644 --- a/stage_descriptions/highlighting-02-bm2.md +++ b/stage_descriptions/highlighting-02-bm2.md @@ -80,7 +80,7 @@ If the input text matches the pattern, your program must: -Any of the following sequences could be used +Any of the following sequences can be used ``` hello\033[31;01m\033[Kmatched\033[m\033[Kworld diff --git a/stage_descriptions/highlighting-04-na5.md b/stage_descriptions/highlighting-04-na5.md index 9fe8109..76b2516 100644 --- a/stage_descriptions/highlighting-04-na5.md +++ b/stage_descriptions/highlighting-04-na5.md @@ -25,16 +25,16 @@ When the output stream is piped to another command, or redirected to a non-TTY d ```bash # Output stream is piped to another command -$ echo -n "apple123" | grep --color=auto -E '\d' | hexdump -C -00000000 61 70 70 6c 65 31 32 33 0a |apple123.| -00000009 +$ echo -n "I have 3 apples" | grep --color=auto -E '\d' | hexdump -C +00000000 49 20 68 61 76 65 20 33 20 61 70 70 6c 65 73 0a |I have 3 apples.| +00000010 # Output stream is redirected to a non-TTY device -$ echo -n "apple123" | grep --color=auto -E '\d' >> output.txt +$ echo -n "I have 4 apples" | grep --color=auto -E '\d' >> output.txt $ hexdump -C output.txt -00000000 61 70 70 6c 65 31 32 33 0a |apple123.| -00000009 +00000000 49 20 68 61 76 65 20 34 20 61 70 70 6c 65 73 0a |I have 4 apples.| +00000010 ``` ### Tests @@ -62,10 +62,10 @@ The tester will also execute your program like this: ```bash # Redirection to a non-tty device -$ echo -n "apple211" | grep --color=auto -E '\d' >> file.txt +$ echo -n "I have 3 horses" | grep --color=auto -E '\d' >> file.txt # Piping to another command -$ echo -n "apple211" | grep --color=auto -E '\d' | another_command +$ echo -n "He has 9 rabbits" | grep --color=auto -E '\d' | another_command ``` For both of these cases, diff --git a/stage_descriptions/highlighting-05-nd0.md b/stage_descriptions/highlighting-05-nd0.md index d152cce..b5d635b 100644 --- a/stage_descriptions/highlighting-05-nd0.md +++ b/stage_descriptions/highlighting-05-nd0.md @@ -21,16 +21,16 @@ When the output stream is piped to another command, or redirected to a non-TTY d ```bash # Output stream is piped to another command -$ echo -n "apple123" | grep -E '\d' | hexdump -C -00000000 61 70 70 6c 65 31 32 33 0a |apple123.| -00000009 +$ echo -n "I have 3 apples" | grep --color=auto -E '\d' | hexdump -C +00000000 49 20 68 61 76 65 20 33 20 61 70 70 6c 65 73 0a |I have 3 apples.| +00000010 # Output stream is redirected to a non-TTY device -$ echo -n "apple123" | grep -E '\d' >> output.txt +$ echo -n "I have 4 apples" | grep --color=auto -E '\d' >> output.txt $ hexdump -C output.txt -00000000 61 70 70 6c 65 31 32 33 0a |apple123.| -00000009 +00000000 49 20 68 61 76 65 20 34 20 61 70 70 6c 65 73 0a |I have 4 apples.| +00000010 ``` ### Tests @@ -38,7 +38,7 @@ $ hexdump -C output.txt The tester will execute your program like this: ```bash -$ echo -n "apple321" | grep -E '\d' +$ echo -n "I have 10 horses" | grep -E '\d' ``` If the input does not match the pattern, your program must: @@ -53,10 +53,10 @@ The tester will also execute your program like this: ```bash # Redirection to a non-tty device -$ echo -n "apple211" | grep -E '\d' >> file.txt +$ echo -n "I have 3 horses" | grep --color=auto -E '\d' >> file.txt # Piping to another command -$ echo -n "apple211" | grep -E '\d' | another_command +$ echo -n "He has 9 rabbits" | grep --color=auto -E '\d' | another_command ``` For both of these cases, From f3af72b609618d2204bd411f45367acb55ded25e Mon Sep 17 00:00:00 2001 From: Udeshya Dhungana <075bct095.udeshya@pcampus.edu.np> Date: Wed, 12 Nov 2025 12:17:50 +0545 Subject: [PATCH 08/12] Update instructions --- course-definition.yml | 7 ---- ...hting-02-bm2.md => highlighting-01-bm2.md} | 0 stage_descriptions/highlighting-01-bx9.md | 32 ------------------- ...hting-03-jk4.md => highlighting-02-jk4.md} | 0 ...hting-04-na5.md => highlighting-03-na5.md} | 0 ...hting-05-nd0.md => highlighting-04-nd0.md} | 0 6 files changed, 39 deletions(-) rename stage_descriptions/{highlighting-02-bm2.md => highlighting-01-bm2.md} (100%) delete mode 100644 stage_descriptions/highlighting-01-bx9.md rename stage_descriptions/{highlighting-03-jk4.md => highlighting-02-jk4.md} (100%) rename stage_descriptions/{highlighting-04-na5.md => highlighting-03-na5.md} (100%) rename stage_descriptions/{highlighting-05-nd0.md => highlighting-04-nd0.md} (100%) diff --git a/course-definition.yml b/course-definition.yml index 245d9b6..323881d 100644 --- a/course-definition.yml +++ b/course-definition.yml @@ -316,13 +316,6 @@ stages: In this stage, we'll add support for `{n,m}`, the [between n and m times](https://docs.microsoft.com/en-us/dotnet/standard/base-types/quantifiers-in-regular-expressions#match-between-n-and-m-times-nm) quantifier. # Highlighting - - slug: "bx9" - primary_extension_slug: "highlighting" - name: "Print matching line to standard output" - difficulty: easy - marketing_md: |- - In this stage, you'll add support for printing the matched line in the standard output of your grep implementation. - - slug: "bm2" primary_extension_slug: "highlighting" name: "Highlight the matched text" diff --git a/stage_descriptions/highlighting-02-bm2.md b/stage_descriptions/highlighting-01-bm2.md similarity index 100% rename from stage_descriptions/highlighting-02-bm2.md rename to stage_descriptions/highlighting-01-bm2.md diff --git a/stage_descriptions/highlighting-01-bx9.md b/stage_descriptions/highlighting-01-bx9.md deleted file mode 100644 index a57276a..0000000 --- a/stage_descriptions/highlighting-01-bx9.md +++ /dev/null @@ -1,32 +0,0 @@ -In this stage, you'll add support for printing the matched line in the standard output of your grep implementation. - -### Printing the matched line - -If a line from the standard input is matched, grep prints the matched line to the standard output. - -Example usage: - -```bash -$ echo -n "caats" | grep -E "ca+ts" -caats -``` - -### Tests - -The tester will execute your program like this: - -```bash -$ echo -n "dogs" | ./your_program.sh -E "dogs?" -dogs -``` - -If the input matches the pattern, your program must: -- Exit with the code 0 -- Print the input line to the standard output - -If the input does not match the pattern, your program must: -- Exit with the code 1 - -### Notes - -- You only need to print the matched line to the standard output. You don't need to highlight the matched text. We'll get to that in the later stages. \ No newline at end of file diff --git a/stage_descriptions/highlighting-03-jk4.md b/stage_descriptions/highlighting-02-jk4.md similarity index 100% rename from stage_descriptions/highlighting-03-jk4.md rename to stage_descriptions/highlighting-02-jk4.md diff --git a/stage_descriptions/highlighting-04-na5.md b/stage_descriptions/highlighting-03-na5.md similarity index 100% rename from stage_descriptions/highlighting-04-na5.md rename to stage_descriptions/highlighting-03-na5.md diff --git a/stage_descriptions/highlighting-05-nd0.md b/stage_descriptions/highlighting-04-nd0.md similarity index 100% rename from stage_descriptions/highlighting-05-nd0.md rename to stage_descriptions/highlighting-04-nd0.md From bdfe1fbced939233b1be15149cc8aeee1541c413 Mon Sep 17 00:00:00 2001 From: Udeshya Dhungana <075bct095.udeshya@pcampus.edu.np> Date: Fri, 14 Nov 2025 10:41:21 +0545 Subject: [PATCH 09/12] Add suggested 'multiple matches highlighting' as an extra stage --- course-definition.yml | 7 ++++ stage_descriptions/highlighting-01-bm2.md | 1 + stage_descriptions/highlighting-02-jk4.md | 3 +- stage_descriptions/highlighting-03-na5.md | 1 + stage_descriptions/highlighting-04-nd0.md | 3 +- stage_descriptions/highlighting-05-eq0.md | 42 +++++++++++++++++++++++ 6 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 stage_descriptions/highlighting-05-eq0.md diff --git a/course-definition.yml b/course-definition.yml index 323881d..7e5b71e 100644 --- a/course-definition.yml +++ b/course-definition.yml @@ -343,3 +343,10 @@ stages: difficulty: easy marketing_md: |- In this stage, you'll implement the `auto` coloring option as the default coloring option when the `--color` flag is not present. + + - slug: "eq0" + primary_extension_slug: "highlighting" + name: "Highlight multiple matches" + difficulty: medium + marketing_md: |- + In this stage, you'll add support for highlighting multiple matches in your grep implementation. \ No newline at end of file diff --git a/stage_descriptions/highlighting-01-bm2.md b/stage_descriptions/highlighting-01-bm2.md index c786628..ab17e57 100644 --- a/stage_descriptions/highlighting-01-bm2.md +++ b/stage_descriptions/highlighting-01-bm2.md @@ -64,6 +64,7 @@ I have 3 apples If the input does not match the pattern, your program must: - Exit with the code 1 +- Exit with no printed output If the input text matches the pattern, your program must: - Exit with the code 0 diff --git a/stage_descriptions/highlighting-02-jk4.md b/stage_descriptions/highlighting-02-jk4.md index ea730aa..194738d 100644 --- a/stage_descriptions/highlighting-02-jk4.md +++ b/stage_descriptions/highlighting-02-jk4.md @@ -26,4 +26,5 @@ If the input matches the pattern, your program must: - No highlights should be placed in the output text because `--color=never` option is being used. If the input does not match the pattern, your program must: -- Exit with the code 1 \ No newline at end of file +- Exit with the code 1 +- Exit with no printed output \ No newline at end of file diff --git a/stage_descriptions/highlighting-03-na5.md b/stage_descriptions/highlighting-03-na5.md index 76b2516..80b5aea 100644 --- a/stage_descriptions/highlighting-03-na5.md +++ b/stage_descriptions/highlighting-03-na5.md @@ -71,6 +71,7 @@ $ echo -n "He has 9 rabbits" | grep --color=auto -E '\d' | another_command For both of these cases, If the input does not match the pattern, your program must: - Exit with the code 1 +- Exit with no printed output If the input text matches the pattern, your program must exit with the code 0 and - The input text should be written to the file `file.txt`, or be supplied to another command, depending on the case. diff --git a/stage_descriptions/highlighting-04-nd0.md b/stage_descriptions/highlighting-04-nd0.md index b5d635b..50c33fa 100644 --- a/stage_descriptions/highlighting-04-nd0.md +++ b/stage_descriptions/highlighting-04-nd0.md @@ -38,11 +38,12 @@ $ hexdump -C output.txt The tester will execute your program like this: ```bash -$ echo -n "I have 10 horses" | grep -E '\d' +$ echo -n "I have 3 horses" | grep -E '\d' ``` If the input does not match the pattern, your program must: - Exit with the code 1 +- Exit with no printed output If the input text matches the pattern, your program must: - Exit with the code 0 diff --git a/stage_descriptions/highlighting-05-eq0.md b/stage_descriptions/highlighting-05-eq0.md new file mode 100644 index 0000000..d3bb8a8 --- /dev/null +++ b/stage_descriptions/highlighting-05-eq0.md @@ -0,0 +1,42 @@ +In this stage, you'll add support for highlighting multiple matches in your grep implementation. + +### Highlighting multiple matches + +Grep highlights all the matching texts it can find in each line. + +Example usage: + + +
+$ echo -n "dogs and cats are pets" | grep --color=always -E '(dogs|cats)'
+dogs and cats are pets
+
+ + +### Tests + +The tester will execute your program like this: + + +
+$ echo -n "jekyll and hyde" | grep --color=always -E '(jekyll|hyde)'
+jekyll and hyde
+
+$ echo -n "2025" | grep --color=always -E '\d' +2025
+ + +If the input does not match the pattern, your program must: +- Exit with the code 1 +- Exit with no printed output + +If the input text matches the pattern, your program must: +- Exit with the code 0 +- Print the input text to the standard output +- Highlight all the matched texts in the input using the grep's default color. + +### Notes + +- The tester accepts multiple valid ANSI-encoded representations of the same highlighted text. To display the bold red text: 2025, any equivalent combination is acceptable. Example of valid ANSI sequences: + - `\u001b[1;31m2025\u001b[0m` + - `\u001b[1;31m20\u001b[0m\u001b[1;31m25\u001b[0m` From ec8cd1962c6a3c1d5dd5eb2b3e3d2ac13826fcce Mon Sep 17 00:00:00 2001 From: Udeshya Dhungana <075bct095.udeshya@pcampus.edu.np> Date: Fri, 14 Nov 2025 11:39:13 +0545 Subject: [PATCH 10/12] Corrected instructions --- stage_descriptions/highlighting-03-na5.md | 2 +- stage_descriptions/highlighting-04-nd0.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stage_descriptions/highlighting-03-na5.md b/stage_descriptions/highlighting-03-na5.md index 80b5aea..91c9241 100644 --- a/stage_descriptions/highlighting-03-na5.md +++ b/stage_descriptions/highlighting-03-na5.md @@ -15,7 +15,7 @@ Example usage: $ echo -n "I have 3 cows" | grep --color=auto -E 'cows' I have 3 cows $ echo -n "I have 4 cows" | grep --color=auto -E 'cows' >> /dev/tty -I have 3 cows +I have 4 cows diff --git a/stage_descriptions/highlighting-04-nd0.md b/stage_descriptions/highlighting-04-nd0.md index 50c33fa..34560f1 100644 --- a/stage_descriptions/highlighting-04-nd0.md +++ b/stage_descriptions/highlighting-04-nd0.md @@ -11,7 +11,7 @@ Example usage: $ echo -n "I have 3 cows" | grep -E 'cows' I have 3 cows $ echo -n "I have 4 cows" | grep -E 'cows' >> /dev/tty -I have 3 cows +I have 4 cows @@ -54,10 +54,10 @@ The tester will also execute your program like this: ```bash # Redirection to a non-tty device -$ echo -n "I have 3 horses" | grep --color=auto -E '\d' >> file.txt +$ echo -n "I have 3 horses" | grep -E '\d' >> file.txt # Piping to another command -$ echo -n "He has 9 rabbits" | grep --color=auto -E '\d' | another_command +$ echo -n "He has 9 rabbits" | grep -E '\d' | another_command ``` For both of these cases, From e9f4865aad1537d6042d937352879ca3ec154884 Mon Sep 17 00:00:00 2001 From: Udeshya Dhungana <075bct095.udeshya@pcampus.edu.np> Date: Fri, 14 Nov 2025 11:53:10 +0545 Subject: [PATCH 11/12] Adjust difficulty for highlighting --- course-definition.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/course-definition.yml b/course-definition.yml index 7e5b71e..153db64 100644 --- a/course-definition.yml +++ b/course-definition.yml @@ -347,6 +347,6 @@ stages: - slug: "eq0" primary_extension_slug: "highlighting" name: "Highlight multiple matches" - difficulty: medium + difficulty: hard marketing_md: |- In this stage, you'll add support for highlighting multiple matches in your grep implementation. \ No newline at end of file From b6278c65eea26ea5108ce7fa12f5405ad3591937 Mon Sep 17 00:00:00 2001 From: Udeshya Dhungana <075bct095.udeshya@pcampus.edu.np> Date: Mon, 17 Nov 2025 09:52:41 +0545 Subject: [PATCH 12/12] Reorder stages --- course-definition.yml | 26 +++++++++---------- stage_descriptions/highlighting-01-bm2.md | 6 +++-- ...hting-05-eq0.md => highlighting-02-eq0.md} | 0 ...hting-02-jk4.md => highlighting-03-jk4.md} | 0 ...hting-03-na5.md => highlighting-04-na5.md} | 0 ...hting-04-nd0.md => highlighting-05-nd0.md} | 0 6 files changed, 17 insertions(+), 15 deletions(-) rename stage_descriptions/{highlighting-05-eq0.md => highlighting-02-eq0.md} (100%) rename stage_descriptions/{highlighting-02-jk4.md => highlighting-03-jk4.md} (100%) rename stage_descriptions/{highlighting-03-na5.md => highlighting-04-na5.md} (100%) rename stage_descriptions/{highlighting-04-nd0.md => highlighting-05-nd0.md} (100%) diff --git a/course-definition.yml b/course-definition.yml index 153db64..895eb52 100644 --- a/course-definition.yml +++ b/course-definition.yml @@ -318,35 +318,35 @@ stages: # Highlighting - slug: "bm2" primary_extension_slug: "highlighting" - name: "Highlight the matched text" + name: "Highlighting a single match" difficulty: hard marketing_md: |- - In this stage, you'll add support for highlighting the matched text in your grep implementation. + In this stage, you'll add support for highlighting a single match in your grep implementation. + + - slug: "eq0" + primary_extension_slug: "highlighting" + name: "Highlighting multiple matches" + difficulty: hard + marketing_md: |- + In this stage, you'll add support for highlighting multiple matches in your grep implementation. - slug: "jk4" primary_extension_slug: "highlighting" - name: "The `never` coloring option" + name: "Disabling highlighting" difficulty: easy marketing_md: |- In this stage, you'll add support for disabling the highlighting in your grep implementation using the `never` coloring option. - slug: "na5" primary_extension_slug: "highlighting" - name: "The `auto` coloring option" + name: "Auto highlighting option" difficulty: medium marketing_md: |- In this stage, you'll add support for `auto` coloring option in the `--color` flag in your grep implementation. - slug: "nd0" primary_extension_slug: "highlighting" - name: "The default behavior" + name: "Default highlighting behavior" difficulty: easy marketing_md: |- - In this stage, you'll implement the `auto` coloring option as the default coloring option when the `--color` flag is not present. - - - slug: "eq0" - primary_extension_slug: "highlighting" - name: "Highlight multiple matches" - difficulty: hard - marketing_md: |- - In this stage, you'll add support for highlighting multiple matches in your grep implementation. \ No newline at end of file + In this stage, you'll implement the `auto` coloring option as the default coloring option when the `--color` flag is not present. \ No newline at end of file diff --git a/stage_descriptions/highlighting-01-bm2.md b/stage_descriptions/highlighting-01-bm2.md index ab17e57..85de8c2 100644 --- a/stage_descriptions/highlighting-01-bm2.md +++ b/stage_descriptions/highlighting-01-bm2.md @@ -1,4 +1,4 @@ -In this stage, you'll add support for highlighting the matched text in your grep implementation. +In this stage, you'll add support for highlighting a single match in your grep implementation. ### Highlighting the matched text @@ -73,7 +73,9 @@ If the input text matches the pattern, your program must: ### Notes -1. The matched text should highlighted using the bold (`01`) and red (`31`) attributes. You may use any combination of ANSI codes to achieve this highlighting effect. For example, to produce the following output: +1. You only need to handle the case of single match. We'll get to highlighting multiple matches in the next stage. + +2. The matched text should highlighted using the bold (`01`) and red (`31`) attributes. You may use any combination of ANSI codes to achieve this highlighting effect. For example, to produce the following output:
diff --git a/stage_descriptions/highlighting-05-eq0.md b/stage_descriptions/highlighting-02-eq0.md
similarity index 100%
rename from stage_descriptions/highlighting-05-eq0.md
rename to stage_descriptions/highlighting-02-eq0.md
diff --git a/stage_descriptions/highlighting-02-jk4.md b/stage_descriptions/highlighting-03-jk4.md
similarity index 100%
rename from stage_descriptions/highlighting-02-jk4.md
rename to stage_descriptions/highlighting-03-jk4.md
diff --git a/stage_descriptions/highlighting-03-na5.md b/stage_descriptions/highlighting-04-na5.md
similarity index 100%
rename from stage_descriptions/highlighting-03-na5.md
rename to stage_descriptions/highlighting-04-na5.md
diff --git a/stage_descriptions/highlighting-04-nd0.md b/stage_descriptions/highlighting-05-nd0.md
similarity index 100%
rename from stage_descriptions/highlighting-04-nd0.md
rename to stage_descriptions/highlighting-05-nd0.md