10.07.2015 Views

Algol 68 - ACM Digital Library

Algol 68 - ACM Digital Library

Algol 68 - ACM Digital Library

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

178/van Wijngaarden, et al.ALGOL <strong>68</strong> Revised Report 179then• the event routine corresponding to on value error is called;• if this returns false, Y is output using put and undefined is called;otherwise, the string is "edited" (jj) using Q;• the insertion of P is performed.ii) A value is input to a name N, using a picture P, as follows:If the pattern Q of P is a "choice" or "general' pattern,then a value is input to N using P (see 10.3.4.8.1.bb,ee, 10.3.4.10.1.bb);otherwise,• P is staticized;• a string controlled by Q is "indited" (kk);If the mode of N is "input compatible" with Q (see the appropriatesection),then• the string is converted to an appropriate value suitable for Nusing Q (see the appropriate section);• if the conversion is successful, the value is assigned to N;If the mode is not input-compatible, or if the conversion isunsuccessful,then• the event routine corresponding to on value error is called;• if this returns false, undefined is called;• the insertion of P is performed.jj) A string is "edited", using a pattern P, as follows:In each part of the string controlled by a sign mould,• if the first character of the string {which indicates the sign) is %"and the sign mould contains a ..... frame, then that character isreplaced by ".";• the first character (i.e., the sign) is shifted to the right across allleading zeroes in this part of the string and these zeroes are replacedby spaces (for example, using the sign mould 4z+, the string "+0003"becomes "...+3") ;In each part of the string controlled by an integral mould,• zeroes controlled by "z" frames are replaced by spaces as follows:• between the start of the string and the first nonzero digit;• between each "d", "e" or "i" frame and the next nonzero digit;(for example, using the pattern zdzd2d, the string "1801<strong>68</strong>" becomes"18.fl<strong>68</strong>"; )For each frame F of P,• the insertion of F is performed;• if F is not suppressed, the characters controlled by F are written;(for example, the string "+0003.5", when edited using the pattern 4z+ s. ","d, causes the string "._._._+3,5" to be written and the string "1801<strong>68</strong>", usingthe pattern zd .... 'zd"-19"2d, gives rise to "18-.1-19<strong>68</strong>").kk) A string is "indited", using a pattern P, as follows:For each frame F of e,• the insertion of F is performed:For each element of the string controlled by F, a character is obtainedas follows:If F is contained in a sign mould,then• if a sign has been found, a digit is expected, with "0" assuggestion:• otherwise, either a "+" or a ..... is expected, with "+" assuggestion, and, in addition, if the sign mould contains a .....frame, then a space preceding the first digit will be accepted asthe sign (and replaced by "+"):otherwise, if F is contained in an integral mould,thenIf F is suppressed,then "0" is supplied;otherwise,Case A: F is a "d" frame:• a digit is expected, with "0" as suggestion:Case B: F is a "z" frame:• a digit or space is expected, with "0" as suggestion, buta space is only acceptable as follows:• between the start of the string and the first nonzerodigit;• between each "d", "e" or "i" frame and the nextnonzero digit;• such spaces are replaced by zeroes:otherwise, if F is an "a" frame,then if F is not suppressed, a character is read and supplied:otherwise "." is supplied:otherwise, if F is not suppressed,then if F is a "." Ce", "i", "b") frame, a "." ("1o" or "\" or "e", "1"or "i", flip or flop) is expected, with "." ("1o", "1", flop) assuggestion:otherwise, if F is a suppressed "." Ce", "i") frame, the character "."("1o", "1") is supplied.ll) A member of a set of characters S is "expected", with thecharacter C as suggestion, as follows:• a character is read:If that character is one of the expected characters (i.e., a member of S),then that character is supplied:otherwise, the event routine corresponding to on char err~r is called, withC as suggestion; if this returns true and G, as possibly replaced, is oneof the expected characters, then that character is supplied: otherwise.undefined is called.}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!