package batteries
- Overview
- No Docs
You can search for identifiers within the package.
in-package search v0.2.0
Install
Dune Dependency
Authors
Maintainers
Sources
md5=d02c4f044e53edca010de46f9139ce00
sha512=99a5afa3604c4cf0c849c670111d617f7f255acb0da043b73ddffdf0e299948bce52516ee31921f269de6088156c4e0a187e0b931543c6819c6b25966b303281
doc/batteries.unthreaded/BatScanf/Scanning/index.html
Module BatScanf.Scanning
Source
Scanning buffers
The type of scanning buffers. A scanning buffer is the source from which a formatted input function gets characters. The scanning buffer holds the current state of the scan, plus a function to get the next char from the input, and a token buffer to store the string matched so far.
Note: a scan may often require to examine one character in advance; when this ``lookahead'' character does not belong to the token read, it is stored back in the scanning buffer and becomes the next character read.
The scanning buffer reading from stdin
. stdib
is equivalent to Scanning.from_input stdin
.
Note: when input is read interactively from stdin
, the newline character that triggers the evaluation is incorporated in the input; thus, scanning specifications must properly skip this character (simply add a '\n'
as the last character of the format string).
Scanning.from_string s
returns a scanning buffer which reads from the given string. Reading starts from the first character in the string. The end-of-input condition is set when the end of the string is reached.
Bufferized file reading in text mode. The efficient and usual way to scan text mode files (in effect, from_file
returns a scanning buffer that reads characters in large chunks, rather than one character at a time as buffers returned by from_channel
do). Scanning.from_file fname
returns a scanning buffer which reads from the given file fname
in text mode.
Scanning.from_function f
returns a scanning buffer with the given function as its reading method.
When scanning needs one more character, the given function is called.
When the function has no more character to provide, it must signal an end-of-input condition by raising the exception End_of_file
.
Scanning.from_input ic
returns a scanning buffer which reads from the input channel ic
, starting at the current reading position.
Scanning.end_of_input ib
tests the end-of-input condition of the given scanning buffer.
Scanning.beginning_of_input ib
tests the beginning of input condition of the given scanning buffer.
Scanning.name_of_input ib
returns the name of the character source for the scanning buffer ib
.
Obsolete
@obsolete use from_input