Compiler/Simple file inclusion pre processor: Difference between revisions
Compiler/Simple file inclusion pre processor (view source)
Revision as of 18:35, 6 June 2021
, 3 years ago→{{header|ALGOL 68}}: Bug fixes
(→{{header|Phix}}: marked incorrect, the penny has just dropped...) |
(→{{header|ALGOL 68}}: Bug fixes) |
||
Line 233:
result
END # get string # ;
#
PROC
BEGIN
STRING result := "";
# within a string denotation, "" denotes the " character #
WHILE cpos < UPB
CHAR ch = s[ c pos
IF NOT have string delimiter THEN▼
unterminated( "string" )▼
FI;
result +:= c▼
FI▼
OD;
result
END #
# gets a bold word from then source #
PROC get bold word = STRING:
Line 297 ⟶ 291:
IF at eof THEN
# unterminated commant #
unterminated( "
FI;
put string( delimiter )
Line 318 ⟶ 312:
IF have string delimiter THEN
# have a file name #
file name := get
pragment +:= file name + get whitespace;
file name := unquote string( file name )
FI;
# should now have the closing delimiter #
IF NOT have bold THEN
# no bold word in/at-the-nd-of the pragment #
ELSE
# have a bold word - could be the delimiter #
pragment +:= ( bold word := get bold word )
Line 332 ⟶ 330:
# not a read/include pragmatic comment #
put string( pragment );
# haven't
▲ FI
ELIF
# attempt to include the file #
|