Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PROCEDURE (this: Parser) readTagValuePair(nesting: INTEGER): ParserError.ParserError;
- (*
- Description: Reads a tag with value pair (e.g. <TAG>X</TAG>) at a specified nesting level. When no error occurs
- the pair is passed on to the consumer
- Param: -nesting nesting level of the pair
- Return: ParserError error that occurs while reading
- *)
- VAR
- openIdentifier, closeIdentifier, contents: Object.Object;
- pair: TagValuePair.TagValuePair;
- BEGIN
- openIdentifier := this.readOpeningTagIdentifier();
- IF (openIdentifier IS ParserError.ParserError) THEN
- RETURN openIdentifier(ParserError.ParserError);
- END;
- (* Eventual Tag-contents *)
- this.skipWhitespace;
- contents := this.readTagContents( nesting );
- this.skipWhitespace();
- IF ( contents # NIL ) & ( contents IS ParserError.ParserError) THEN;
- RETURN contents(ParserError.ParserError);
- END;
- closeIdentifier := this.readClosingTagIdentifier();
- IF (closeIdentifier IS ParserError.ParserError) THEN
- RETURN closeIdentifier(ParserError.ParserError);
- END;
- IF openIdentifier(StringTypes.String) = closeIdentifier(StringTypes.String) THEN
- NEW(pair);
- pair.init(openIdentifier(StringTypes.String));
- IF contents # NIL THEN
- pair.setValue(contents(StringTypes.String));
- END;
- this.consumer.foundAt(pair, nesting);
- ELSE
- Out.String("Fout bij parsen - openidentifier is niet gelijk aan closingidentifier");
- Out.Ln();
- Out.String(" - ga door met parsen");
- END;
- RETURN NIL;
- END readTagValuePair;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement