6.2.2535 \ backslash CORE EXT


Perform the execution semantics given below.


( "ccc<eol>" -- )

Parse and discard the remainder of the parse area. \ is an immediate word.



Typical use:
5 CONSTANT THAT \ This is a comment about THAT


JimPetersonavatar of JimPeterson [289] Maybe `REFILL`?Suggested reference implementation2023-02-23 16:26:01

Is this, effectively: : \ REFILL DROP ; IMMEDIATE ?

The description says "... parse and discard...", but wouldn't simply "... discard..." suffice? Also, REFILL strongly implies that it operates one line at a time. Maybe that is specified elsewhere in the spec?

ruvavatar of ruv

Is this, effectively:


It isn't acceptable, since REFILL may change the input buffer, but "\" must not change the input buffer.

See Input buffers: "The address and length returned by SOURCE, the string returned by PARSE, and directly computed input-buffer addresses are valid only until the text interpreter does I/O to refill the input buffer or the input source is changed".

wouldn't simply "... discard..." suffice?

"To parse" is a formal term, which also refers "3.4.1 Parsing" that describes the behavior in details (i.e, how >IN is changed). "Discard" means that the parsed string is not used. Without "parse" the specified behavior would be less clear.

REFILL strongly implies that it operates one line at a time.

In the general case, it depends on the input source kind. If you want to be independent on that kind, you cannot assume that REFILL operates on text lines. See my post Portable line-oriented parsing on this regard.

Reply New Version