mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 00:32:24 +00:00
example on how to read commandline arguments with Texts.
This commit is contained in:
parent
5a93546143
commit
dfaf2d3622
1 changed files with 24 additions and 0 deletions
24
src/test/texts/argTexts.Mod
Normal file
24
src/test/texts/argTexts.Mod
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
MODULE argTexts; (* example how to get arguments by using Texts module *)
|
||||||
|
IMPORT Texts, Oberon;
|
||||||
|
|
||||||
|
VAR
|
||||||
|
S: Texts.Scanner; (* we'll read program arguments with it *)
|
||||||
|
|
||||||
|
W : Texts.Writer; (* to write to console *)
|
||||||
|
T : Texts.Text;
|
||||||
|
|
||||||
|
BEGIN
|
||||||
|
Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos);
|
||||||
|
Texts.Scan(S);
|
||||||
|
(*Out.String(S.s); Out.Ln;*)
|
||||||
|
|
||||||
|
Texts.OpenWriter (W);
|
||||||
|
|
||||||
|
Texts.WriteString(W, "aaa");
|
||||||
|
Texts.WriteLn(W);
|
||||||
|
Texts.WriteString(W, S.s);
|
||||||
|
Texts.WriteLn(W);
|
||||||
|
Texts.Append(Oberon.Log, W.buf);
|
||||||
|
|
||||||
|
|
||||||
|
END argTexts.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue