Skip to content

Commit

Permalink
Funnier parsing error-messages, generated with Chat GPT.
Browse files Browse the repository at this point in the history
  • Loading branch information
trizen committed Nov 3, 2024
1 parent a561092 commit adabed4
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 26 deletions.
80 changes: 54 additions & 26 deletions lib/Sidef/Parser.pm
Original file line number Diff line number Diff line change
Expand Up @@ -437,35 +437,63 @@ package Sidef::Parser {
}

my @lines = (
"HAHA! That's really funny! You got me!",
"I thought that... Oh, you got me!",
"LOL! I expected... Oh, my! This is funny!",
"Oh, oh... Wait a second! Did you mean...? Damn!",
"You're embarrassing me! That's not funny!",
"My brain just exploded.",
"Sorry, I don't know how to help in this situation.",
"I'm broken. Fix me, or show this to someone who can fix",
"Huh?",
"Out of order",
"You must be joking.",
"Ouch, That HURTS!",
"Who are you!?",
"Death before dishonour?",
"Good afternoon, gentleman, I'm a HAL 9000 Computer",
"Okie dokie, I'm dead",
"Help is not available for you.",
"Your expression has defeated me",
"Your code has defeated me",
"Your logic has defeated me",
"Weird magic happens here",
"I give up... dumping core now!",
"Okie dokie, core dumped.bash",
"You made me die. Shame on you!",
"Invalid code. Feel ashamed for yourself and try again.",

"Your code forgot how to 'human.' Please give it some structure!",
"Were you trying to summon Cthulhu, or is this just a typo?",
"This line of code is in denial. It doesn't want to cooperate.",
"Parser has encountered a disturbance in the Force. It appears your code has gone to the dark side.",
"Code drunk. Fix before it starts ordering random APIs online.",
"Did you mean to do that? Because your code just broke the Matrix.",
"Your syntax seems to have taken a coffee break.",
"Your code is trying to summon Skynet. Abort while you can!",
"This isn’t a Choose Your Own Adventure. Stick to the script!",
"Well, that’s not going to work. Try again, friend.",

"If this is what you meant, we need to have a talk.",
"Uh-oh! Looks like your code slipped on a banana peel.",
"Your code is having an existential crisis. It doesn’t know who it is anymore.",
"Something’s wrong… but hey, at least you tried!",
"The code didn’t like that. In fact, it’s offended.",
"You’re one typo away from greatness. Unfortunately, this isn’t it.",
"Well, that’s awkward. Let’s pretend that didn’t happen.",
"Your code needs more coffee. Or maybe you do.",

"I have no idea what I just read.",
"Oops! The parser is confused and needs a moment to reboot its brain.",
"The code is speaking in riddles. Try again in plain text.",
"Parser ran out of breadcrumbs to follow your logic trail.",
"It’s like trying to read a book with missing pages.",
"The code went that way… and then it didn’t.",
"Parser gave up. It’s currently hiding under the desk.",
"It’s not you, it’s… okay, it’s definitely you.",
"Parser needs a map and a flashlight to navigate this code.",
"Parser has encountered a wild puzzle. It refuses to continue without a cheat sheet.",

"Your code just sent me on a wild goose chase. No geese found.",
"The parser tried to follow the logic, but it got lost in the spaghetti code.",
"Your code just opened a wormhole. Destination: unknown.",
"I’ve parsed Shakespeare, but this? This is next level.",
"The parser tripped over a missing semicolon and is now in the fetal position.",
"This code smells… like it’s on fire. Someone grab an extinguisher!",
"The parser and the code had a staring contest. The parser blinked first.",
"Parser has lost the plot. Please send a clearer script.",
"The code just threw a plot twist. Even the parser didn’t see that coming.",
"It tried to make sense of your code, then rage quit.",

"The code ventured into the unknown… and didn’t leave a map.",
"The parser tried to keep up, but your code is like a soap opera—too many plot twists.",
"Your code is speaking Parseltongue. I need an interpreter.",
"The parser has encountered an enigma wrapped in a mystery, coded in confusion.",
"The parser felt a great disturbance in the code, as if thousands of bugs cried out in terror.",
"The code just ghosted me. No clues, no closure, nothing.",
"Parser tangled in a logic loop. Send help. Or snacks.",
"The code is playing hide and seek. The parser isn’t winning.",
"The parser tried reasoning with the code, but it’s ignoring all logic.",
"Parser has encountered Schrödinger’s code. It’s both broken and not broken, but we won’t know until you fix it.",
);

my $error = sprintf("%s: %s\n\nFile : %s\nLine : %s : %s\nError: %s\n\n" . ("~" x 80) . "\n%s\n",
'sidef',
'Parsing error',
$lines[rand @lines],
$self->{file_name} // '-',
$line, $column, join(', ', grep { defined } $opt{error}, $opt{reason}), $error_line);
Expand Down
11 changes: 11 additions & 0 deletions scripts/Tests/number_methods.sf
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,17 @@ assert(!is_cyclic(2**256 - 1))
assert(!is_cyclic(2**256 - 11))
assert(!is_cyclic(100!))

# OEIS: A376332
assert(1..12 -> map {|k| 489118019 - k! }.all{.is_semiprime})
assert(1..13 -> map {|k| 6233987183 - k! }.all{.is_semiprime})
assert(1..14 -> map {|k| 87199150463 - k! }.all{.is_semiprime})
assert(1..15 -> map {|k| 1310334397523 - k! }.all{.is_semiprime})
assert(1..16 -> map {|k| 20937254735843 - k! }.all{.is_semiprime})
assert(1..17 -> map {|k| 355693511854763 - k! }.all{.is_semiprime})

assert(33110689978317405605970.phi.is_power(14))
assert(1262838284613442604484690.phi.is_power(15))

assert_eq(sum_primes(1e6), 37550402023)
assert_eq(sum_primes(1, 1e6, 2), 24693298341834533)
assert_eq(sum_primes(2, 1e6, 3), 18393235410255348281725)
Expand Down

0 comments on commit adabed4

Please sign in to comment.