The Shulchan Aruch · Orach Chayim
אורח חיים תקס״דOrach Chayim 564
Siman 564 of 697 in Orach Chayim — 1 se'if
הלכות תעניתLaws of Fast Days· siman 564
Se’if 1א׳
כָּל תַּעֲנִית שֶׁאוֹכְלִים בּוֹ בַּלַּיְלָה, בֵּין צִבּוּר בֵּין יָחִיד, הֲרֵי זֶה אוֹכֵל וְשׁוֹתֶה עַד שֶׁיַּעֲלֶה עַמּוּד הַשַּׁחַר, וְהוּא שֶׁלֹּא יָשַׁן שְׁנַת קֶבַע (טוּר), אֲבָל אִם יָשַׁן שְׁנַת קֶבַע אֵינוֹ חוֹזֵר וְאוֹכֵל וְלֹא שׁוֹתֶה, אֶלָּא אִם כֵּן הִתְנָה לֶאֱכֹל אוֹ לִשְׁתּוֹת. הַגָּה: וְיֵשׁ אוֹמְרִים דְּבִשְׁתִיָּה אֵין צָרִיךְ תְּנַאי, דְּמִסְּתָמָא דַּעְתּוֹ שֶׁל אָדָם לִשְׁתִיָּה אַחַר הַשֵּׁנָה, וְהָוֵי כְּאִלּוּ הִתְנָה (טוּר וּמָרְדְּכַי וְהַגָּהוֹת מַיְמוֹנִי וְהַגָּהוֹת אֲשֵׁרִי).
On every fast that one eats at night, whether it is a communal or individual fast, one may eat and drink until dawn. This holds if one does not sleep (for a long time) (Tur), but if one sleeps (for a long time), he may not go back and eat and drink unless he made a condition [prior to sleeping] to eat and drink. Rem"a: There are those who say that drinking requires no condition, as we assume that a person intends to drink after sleeping and it is as if he made the condition (Tur, Mordechai, Hagahot Maimoniot, and Hagahot Ashri).
Shulchan Aruch, Orach Chayim — Torat Emet 363 edition, via Sefaria — public domain
English: Sefaria Community Translation — CC0